var oldObjArrayAllReservation = new Array();
var countSetFilterTypeStatusAll = 0;
var linkClick = true;
var ShowNameGuest = "";
var textPrint = "";
var textRoomCheckIn ="";
var textRoomCheckInPrint ="";
function UniqueArray(data)
{
	var tmp = {}, out = [];
	for(var i = 0, n = data.length; i < n; ++i)
	{
		if(!tmp[data[i].groupId]) { 
			if(data[i].groupId==0){
				tmp[data[i].groupId] = false;
			}else{
				
				if(data[i].subList!=undefined&&data[i].subList!=null){
					tmp[data[i].groupId] = true;
				}else{
					tmp[data[i].groupId] = false;
				}
			}
			out.push(data[i]); 
		}
	}
	return out;
}
//////////////Start CheckIn Page ////////////////
function searchAll_allPage(value,e){
	/*if (e.keyCode == 13 && !e.ctrlKey) {
		getReservationRoomAllManageMent("textSearch",value)
		$("#SearchAll_allPage").val("");
	}*/
}
function getReservationRoomAllManageMent(data,valueSearch){
	clearData();
	waitingDialog({});
	var searchName = $("#SearchAll_allPage").val();
	if($("#RowpagerCheckInListRoomManageMent").val() == null){
		getCurrentTabData().lineAllreservation = 10;
	}else{
		getCurrentTabData().lineAllreservation = $("#RowpagerCheckInListRoomManageMent").val();
	}
	if($("#pagerCheckInListRoomManageMent").val() == null){
		var pagePointer = 1;
	}else{
		if(valueSearch!=""&&valueSearch!=undefined){
			var pagePointer = valueSearch; 
		}else{
			var pagePointer = 1;
			getCurrentTabData().pagerNumber = 1;
		}
	}
	var offfset = (getCurrentTabData().lineAllreservation*pagePointer)-getCurrentTabData().lineAllreservation;
	var dataOld =  $("#typeCheckReservationAll").val();
	var firstSelect = $("[setoption=TypeResvAll]").val();
	var valueDateCheckin = $("#calendar_btw_checkinAll").attr("dateofbtwcheckinAll");
	var valueDateCheckout = $("#calendar_btw_checkoutAll").attr("dateofbtwcheckoutAll");
	if(valueDateCheckin!=""&&valueDateCheckout!=""){
		var dateCheckin = $("#calendar_btw_checkinAll").attr("dateofbtwcheckinAll");
	  	var dateCheckout = $("#calendar_btw_checkoutAll").attr("dateofbtwcheckoutAll");
	  	$("#calendar_btw_checkinAll").val($.datepicker.parseDate("yy-mm-dd",dateCheckin).getFormatedString());
		$("#calendar_btw_checkoutAll").val($.datepicker.parseDate("yy-mm-dd",dateCheckout).getFormatedString());
		$('#calendar_btw_checkinAll').attr('dateofbtwcheckinAll',dateCheckin);
		$('#calendar_btw_checkoutAll').attr('dateofbtwcheckoutAll',dateCheckout);
		getCurrentTabData().valueDateCheckin = dateCheckin;
		getCurrentTabData().valueDateCheckout = dateCheckout;
	}else{
		var dateCheckin = new Date().toSystemFormat();
		var dateCheckout= new Date().toSystemFormat();
		$("#calendar_btw_checkinAll").val($.datepicker.parseDate("yy-mm-dd",dateCheckin).getFormatedString());
		$("#calendar_btw_checkoutAll").val($.datepicker.parseDate("yy-mm-dd",dateCheckout).getFormatedString());
		$('#calendar_btw_checkinAll').attr('dateofBtwCheckoutAll',dateCheckin);
		$('#calendar_btw_checkoutAll').attr('dateofBtwCheckoutAll',dateCheckout);
		getCurrentTabData().valueDateCheckin = dateCheckin;
		getCurrentTabData().valueDateCheckout = dateCheckout;
	}
	if(data=="CheckInListRoomManageMent"){
		typeReservationAllFunction(dataOld,offfset,pagePointer,dateCheckin,dateCheckout,firstSelect,searchName);
	}else if(data=="G"){
		getCurrentTabData().beforePageAllReservation = ""; 
		getCurrentTabData().beforeSubPageAllReservation = "";
		var dataOld =  $("#typeCheckReservationAll").val();
		if(dataOld=="G"){
			getCurrentTabData().typeReservationAll = dataOld;
			if(pagePointer>1){
				var link = "/reservationService?func=getReservationAllGroup&offset="
					+offfset+"&line="+getCurrentTabData().lineAllreservation+"&pagePointer="
					+(pagePointer-1)+"&dateCheckin="+dateCheckin+"&dateCheckout="+dateCheckout+"&typereservation="+firstSelect+"&SearchAll_checkoutPage="+searchName;
				var linkSet = "/reservationService?func=getReservationAllGroup&offset="
					+offfset+"&line="+getCurrentTabData().lineAllreservation+"&pagePointer="
					+pagePointer+"&dateCheckin="+dateCheckin+"&dateCheckout="+dateCheckout+"&typereservation="+firstSelect+"&SearchAll_checkoutPage="+searchName;
				getCurrentTabData().linkSet = linkSet;
				simpleservice(link,null,showDataResRoomManageMentSetCountAllReservation,getCurrentTabData().lineAllreservation);
			}else{
				getCurrentTabData().beforePageAllReservation = ""; 
				getCurrentTabData().beforeSubPageAllReservation = "";
				var link = "/reservationService?func=getReservationAllGroup&offset="
					+offfset+"&line="+getCurrentTabData().lineAllreservation+"&pagePointer="
					+pagePointer+"&dateCheckin="+dateCheckin+"&dateCheckout="+dateCheckout+"&typereservation="+firstSelect+"&SearchAll_checkoutPage="+searchName;
				simpleservice(link,null,showDataResRoomAllManageMent,"dateSearch");
			}
		}
	}else if(data=="S"){
		getCurrentTabData().beforePageAllReservation = ""; 
		getCurrentTabData().beforeSubPageAllReservation = "";
		var dataOld =  $("#typeCheckReservationAll").val();
		if(dataOld=="S"){
			getCurrentTabData().typeReservationAll = dataOld;
			if(pagePointer>1){
				var link = "/reservationService?func=getReservationAllSingle&offset="
					+offfset+"&line="+getCurrentTabData().lineAllreservation+"&pagePointer="
					+(pagePointer-1)+"&dateCheckin="+dateCheckin+"&dateCheckout="+dateCheckout+"&typereservation="+firstSelect+"&SearchAll_checkoutPage="+searchName;
				var linkSet = "/reservationService?func=getReservationAllSingle&offset="
					+offfset+"&line="+getCurrentTabData().lineAllreservation+"&pagePointer="
					+pagePointer+"&dateCheckin="+dateCheckin+"&dateCheckout="+dateCheckout+"&typereservation="+firstSelect+"&SearchAll_checkoutPage="+searchName;
				getCurrentTabData().linkSet = linkSet;
				simpleservice(link,null,showDataResRoomManageMentSetCountAllReservation,getCurrentTabData().lineAllreservation);
			}else{
				getCurrentTabData().beforePageAllReservation = ""; 
				getCurrentTabData().beforeSubPageAllReservation = "";
				var link = "/reservationService?func=getReservationAllSingle&offset="
					+offfset+"&line="+getCurrentTabData().lineAllreservation+"&pagePointer="
					+pagePointer+"&dateCheckin="+dateCheckin+"&dateCheckout="+dateCheckout+"&typereservation="+firstSelect+"&SearchAll_checkoutPage="+searchName;
				simpleservice(link,null,showDataResRoomAllManageMent,"dateSearch");
			}
		}
	}else if(data=="A"){
		getCurrentTabData().beforePageAllReservation = ""; 
		getCurrentTabData().beforeSubPageAllReservation = "";
		var dataOld =  $("#typeCheckReservationAll").val();
		var valueDateCheckin = $("#calendar_btw_checkinAll").attr("dateofbtwcheckinAll");
		var valueDateCheckout = $("#calendar_btw_checkoutAll").attr("dateofbtwcheckoutAll");
		getCurrentTabData().typeReservationAll = dataOld;
		if(pagePointer>1){
			var link = "/reservationService?func=getReservationAll&offset="
				+offfset+"&line="+getCurrentTabData().lineAllreservation+"&pagePointer="
				+(pagePointer-1)+"&dateCheckin="+dateCheckin+"&dateCheckout="+dateCheckout+"&typereservation="+firstSelect+"&SearchAll_checkoutPage="+searchName;
			var linkSet = "/reservationService?func=getReservationAll&offset="
				+offfset+"&line="+getCurrentTabData().lineAllreservation+"&pagePointer="
				+pagePointer+"&dateCheckin="+dateCheckin+"&dateCheckout="+dateCheckout+"&typereservation="+firstSelect+"&SearchAll_checkoutPage="+searchName;
			getCurrentTabData().linkSet = linkSet;
			simpleservice(link,null,showDataResRoomManageMentSetCountAllReservation,getCurrentTabData().lineAllreservation);
		}else{
			getCurrentTabData().beforePageAllReservation = ""; 
			getCurrentTabData().beforeSubPageAllReservation = "";
			var link = "/reservationService?func=getReservationAll&offset="
				+offfset+"&line="+getCurrentTabData().lineAllreservation+"&pagePointer="
				+pagePointer+"&dateCheckin="+dateCheckin+"&dateCheckout="+dateCheckout+"&typereservation="+firstSelect+"&SearchAll_checkoutPage="+searchName;
			simpleservice(link,null,showDataResRoomAllManageMent,"dateSearch");
		}
	}else if(data=="reservationType_A"){
		getCurrentTabData().TypeResvAll = data;
		typeReservationAllFunction(dataOld,offfset,pagePointer,dateCheckin,dateCheckout,data,searchName);
	}else if(data=="Reserved Rooms"){
		getCurrentTabData().TypeResvAll = data;
		typeReservationAllFunction(dataOld,offfset,pagePointer,dateCheckin,dateCheckout,data,searchName);
	}else if(data=="Checked-out Rooms"){
		getCurrentTabData().TypeResvAll = data;
		typeReservationAllFunction(dataOld,offfset,pagePointer,dateCheckin,dateCheckout,data,searchName);
	}else if(data=="Checked-in Rooms"){
		getCurrentTabData().TypeResvAll = data;
		typeReservationAllFunction(dataOld,offfset,pagePointer,dateCheckin,dateCheckout,data,searchName);
	}/*else if(data == "textSearch"){
		showDataResRoomAllManageMent(data,"textSearch");
	}*/else if(data == "dateSearch"){
		getCurrentTabData().beforePageAllReservation = ""; 
		getCurrentTabData().beforeSubPageAllReservation = "";
		getCurrentTabData().checkinAllreservation = valueDateCheckin;
		getCurrentTabData().checkoutAllreservation = valueDateCheckout;
		if(valueDateCheckin!=""&&valueDateCheckout!=""){
			getCurrentTabData().valueDateCheckin = valueDateCheckin;
				if(dataOld=="G"){
					getCurrentTabData().typeReservationAll = dataOld;
					if(pagePointer>1){
						var link = "/reservationService?func=getReservationAllGroup&offset="
							+offfset+"&line="+getCurrentTabData().lineAllreservation+"&pagePointer="+(pagePointer-1)+"&dateCheckin="+dateCheckin+"&dateCheckout="
							+dateCheckout+"&typereservation="+firstSelect+"&SearchAll_checkoutPage="+searchName;
						var linkSet = "/reservationService?func=getReservationAllGroup&offset="
							+offfset+"&line="+getCurrentTabData().lineAllreservation+"&pagePointer="+pagePointer+"&dateCheckin="
							+dateCheckin+"&dateCheckout="+dateCheckout+"&typereservation="+firstSelect+"&SearchAll_checkoutPage="+searchName;
						getCurrentTabData().linkSet = linkSet;
						simpleservice(link,null,showDataResRoomManageMentSetCountAllReservation,getCurrentTabData().lineAllreservation);
					}else{
						getCurrentTabData().beforePageAllReservation = ""; 
						getCurrentTabData().beforeSubPageAllReservation = "";
						var link = "/reservationService?func=getReservationAllGroup&offset="
							+offfset+"&line="+getCurrentTabData().lineAllreservation+"&pagePointer="
							+pagePointer+"&dateCheckin="+dateCheckin+"&dateCheckout="+dateCheckout
							+"&typereservation="+firstSelect+"&SearchAll_checkoutPage="+searchName;
						simpleservice(link,null,showDataResRoomAllManageMent,data);
					}
				}else if(dataOld=="S"){
					getCurrentTabData().typeReservationAll = dataOld;
					if(pagePointer>1){
						var link = "/reservationService?func=getReservationAllSingle&offset="
							+offfset+"&line="+getCurrentTabData().lineAllreservation+"&pagePointer="
							+(pagePointer-1)+"&dateCheckin="+dateCheckin+"&dateCheckout="+dateCheckout+"&typereservation="+firstSelect
							+"&SearchAll_checkoutPage="+searchName;
						var linkSet = "/reservationService?func=getReservationAllSingle&offset="
							+offfset+"&line="+getCurrentTabData().lineAllreservation+"&pagePointer="+pagePointer
							+"&dateCheckin="+dateCheckin+"&dateCheckout="+dateCheckout+"&typereservation="
							+firstSelect+"&SearchAll_checkoutPage="+searchName;
						getCurrentTabData().linkSet = linkSet;
						simpleservice(link,null,showDataResRoomManageMentSetCountAllReservation,getCurrentTabData().lineAllreservation);
					}else{
						getCurrentTabData().beforePageAllReservation = ""; 
						getCurrentTabData().beforeSubPageAllReservation = "";
						var link = "/reservationService?func=getReservationAllSingle&offset="
							+offfset+"&line="+getCurrentTabData().lineAllreservation+"&pagePointer="
							+pagePointer+"&dateCheckin="+dateCheckin+"&dateCheckout="+dateCheckout+"&typereservation="
							+firstSelect+"&SearchAll_checkoutPage="+searchName;
						simpleservice(link,null,showDataResRoomAllManageMent,data);
					}
				}else if(dataOld=="A"){
					getCurrentTabData().typeReservationAll = dataOld;
					if(pagePointer>1){
						var link = "/reservationService?func=getReservationAll&offset="
							+offfset+"&line="+getCurrentTabData().lineAllreservation+"&pagePointer="
							+(pagePointer-1)+"&dateCheckin="+dateCheckin+"&dateCheckout="+dateCheckout+"&typereservation="
							+firstSelect+"&SearchAll_checkoutPage="+searchName;
						var linkSet = "/reservationService?func=getReservationAll&offset="
							+offfset+"&line="+getCurrentTabData().lineAllreservation+"&pagePointer="
							+pagePointer+"&dateCheckin="+dateCheckin+"&dateCheckout="+dateCheckout+"&typereservation="
							+firstSelect+"&SearchAll_checkoutPage="+searchName;
						getCurrentTabData().linkSet = linkSet;
						simpleservice(link,null,showDataResRoomManageMentSetCountAllReservation,getCurrentTabData().lineAllreservation);
					}else{
						getCurrentTabData().beforePageAllReservation = ""; 
						getCurrentTabData().beforeSubPageAllReservation = "";
						var link = "/reservationService?func=getReservationAll&offset="
							+offfset+"&line="+getCurrentTabData().lineAllreservation+"&pagePointer="
							+pagePointer+"&dateCheckin="+dateCheckin+"&dateCheckout="+dateCheckout+"&typereservation="
							+firstSelect+"&SearchAll_checkoutPage="+searchName;
						simpleservice(link,null,showDataResRoomAllManageMent,data);
					}
				}
		}else{
			$("#calendar_btw_checkinAll").select();
		}
	}
}
function showDataResRoomAllManageMent(data,output){
	setPagerAllReservation();
	var valueDateCheckin = getCurrentTabData().valueDateCheckin;
	var valueDateCheckout = getCurrentTabData().valueDateCheckout;
	if(valueDateCheckin!=""&&valueDateCheckout!=""){
		var dateCheckin = valueDateCheckin;
	  	var dateCheckout = valueDateCheckout;
	  	$("#calendar_btw_checkinAll").val($.datepicker.parseDate("yy-mm-dd",dateCheckin).getFormatedString());
		$("#calendar_btw_checkoutAll").val($.datepicker.parseDate("yy-mm-dd",dateCheckout).getFormatedString());
		$('#calendar_btw_checkinAll').attr('dateofbtwcheckinAll',dateCheckin);
		$('#calendar_btw_checkoutAll').attr('dateofbtwcheckoutAll',dateCheckout);
	}
	if(data.trim()=="[]"||data.trim()==""){
		$("[clearTr=allReservation]").remove();
		var textDataEmpty = '<tr clearTr="allReservation" >'+
		'<td colspan="100%" style="text-align:center;" >'+
		dataEmpty+
		'</td>'+
		'</tr>';
		$("#CheckInListRoomManageMent_Id_Tr").replaceWith("<tr id=CheckInListRoomManageMent_Id_Tr ></tr>"+textDataEmpty);
		$("#pageNavPositionAllReservation").replaceWith("<div id='pageNavPositionAllReservation' style='padding-top: 20px' align='center'></div>");
		textRoomCheckIn = '';
	}else{
	$("[clearTr=allReservation]").remove();
	var objArray = new Array();
	if((data=="textSearch"||data=="G"||data=="S"||data=="A"||data=="reservationType_A"||data=="Checked-out Rooms"
		||data=="Checked-in Rooms")&&data!="dateSearch"
		||data=="Reserved Rooms"||data=="Checked-out Rooms"||data=="Checked-in Rooms"){
		objArray = oldObjArrayAllReservation;
		objArray = objArray[0];
	}else{
		objArray = JSON.parse(data);
		oldObjArrayAllReservation = JSON.parse(data);
		objArray = objArray[0];
	}
	textPrint = '';
	textRoomCheckInPrint = '';
	//// for Add New Group /////Remove Repeat Group
	var dataUnique = JSON.stringify(objArray);
	objArray = UniqueArray(objArray);
	objArray = sortIdRoommanagement(objArray);
	//objArray = sortDateRoommanagement(objArray);
	var numberSet = getCurrentTabData().beforePageAllReservation; 
	var numberSubSet = getCurrentTabData().beforeSubPageAllReservation;
		var countGroup = 0;
		var OldGroupId =0;
		var emailPic = '<img src=../images/components/roommanagement/email.png alt=Note height=15 width=20>';
		var printPci = '<img src=../images/components/roommanagement/print.png alt=Note height=15 width=20>';
		var groupSplit = '<img src=../images/components/roommanagement/groupSplit.png alt=Note height=10 width=15>';
		var checkGroupDisplay = "";
		var checkBgColor = 0;
		var Description = "";
		var firstSelect = $("[setoption=TypeResvAll]").val();
		//var valueSearch = $("#SearchAll_allPage").val();
		var typeReservation =  $("#typeCheckReservationAll").val();
		// SETOPTION
		var OptionReservation = 0;
		var OptionCheckout = 0;
		var OptionCheckIn = 0;
		for(var i =0;i<objArray.length;i++){
			if(objArray[i].name!=""&&objArray[i].name!=undefined){
				var nameReservation = objArray[i].name.split(" ");
			}
			if(objArray[i].description!=undefined&&objArray[i].description!=""){
				Description = objArray[i].description;
			}else{
				Description = "";
			}
			var Objtitle = objArray[i].reservationTitle;
			var ObjgroupId = objArray[i].groupId;
			var ObjId = objArray[i].id;
			//var checkContinue = checkedFilter(output,valueSearch,nameReservation,firstSelect,Objtitle,ObjgroupId,typeReservation,ObjId)
			/*if(checkContinue==1){
				continue;
			}*/
			if(objArray[i].groupId !=0){
				if(objArray[i].subList!=undefined){
					///Set Date
					var setDateFormat =$.datepicker.formatDate('yy-mm-dd', new Date(objArray[i].date));
					var setDateFormat = $.datepicker.parseDate("yy-mm-dd",setDateFormat);
					var setFateFormatCheckout = setDateFormat.addDate(objArray[i].span);
					var Empty = 0;
					groupId = objArray[i].groupIdString;
						var splitResIdInGroup = objArray[i].resList.split(",");
						var textSubRes = "";
						var textSubResPrint = "";
						var checkBgColorG =0;
						var StatusResInGroup = "";
						var statusRecord = "";
						for(var subRes = 0;subRes<objArray[i].subList.length;subRes++){
							var DescriptionSubRes = "";
							if(objArray[i].subList[subRes].description!=undefined&&objArray[i].subList[subRes].description!=""){
								DescriptionSubRes = objArray[i].subList[subRes].description;
							}else{
								DescriptionSubRes = "";
							}
							var setDateFormatRes = new Date(objArray[i].subList[subRes].date);
							var setFateFormatCheckoutRes = setDateFormatRes.addDate(objArray[i].subList[subRes].span);
							var DisplayGuest = "";
							var formatDateCheckin = setDateFormatRes.getFormatedString();
							/// Name Empty
							if(objArray[i].subList[subRes].name!=undefined){
								ShowNameGuest = objArray[i].subList[subRes].name
							}else{
								ShowNameGuest = 0;
							}
							///
							if(objArray[i].subList[subRes].reservationTitle=="Reserved Rooms"){
								StatusResInGroup = statusResv;
							}else if(objArray[i].subList[subRes].reservationTitle=="Checked-out Rooms"){
								StatusResInGroup = statusCheckOut;
							}else if(objArray[i].subList[subRes].reservationTitle=="Temp Rooms"){
								StatusResInGroup = statusTempResv;
							}else if(objArray[i].subList[subRes].reservationTitle=="Cancel Reservation"){
								StatusResInGroup = statusCancel;
							}else{
								StatusResInGroup = statusCheckin;
							}
							if(checkBgColorG==0){
								statusRecord = 'dataRecordBot';
								checkBgColorG = 1;
							}else{
								statusRecord = 'dataRecordBot';
								checkBgColorG =0;
							}
							var displayNameGuest = "";
							if(ShowNameGuest==0){
								DisplayGuest = "-";
								displayNameGuest = '<tr clearTr="allReservation" class="'+statusRecord+'" onclick="if(linkClick==true)noGuestName();" id="btnEditS" >';
							}else{
								DisplayGuest = ShowNameGuest;
								displayNameGuest = '<tr clearTr="allReservation" class="'+statusRecord+'" onclick="if(linkClick==true){ CallEditReservedPageWithLoadElement(id,'+objArray[i].subList[subRes].id+')}"  id="btnEditS" >';
							}
							var obj = objArray[i].subList[subRes];
							for (var k in obj){ if (obj.hasOwnProperty(k)){obj[k] = String(obj[k]);}} //object to string
							objArray[i].subList[subRes] = obj;
							var re2 = /"/gi;
							var sendData = JSON.stringify(objArray[i].subList[subRes]).replace(re2, "'");
							// run number
							var runnumberSub = "";
							if(getCurrentTabData().beforePageAllReservation!=undefined&&getCurrentTabData().beforePageAllReservation!=""){
								runnumberSub = (numberSet+1)+"."+(subRes+1);
							}else{
								runnumberSub = (i+1)+"."+(subRes+1);
							}
							textSubRes += displayNameGuest+
								'<td colspan="2" class="spanDataPaddingLeftSub">'+
									'<input groupId='+groupId+' name="subReservation" subres='+objArray[i].subList[subRes].id+' type="checkbox" onmouseover="linkClick=false;" onmouseout="linkClick=true;" >'+runnumberSub+
								'</td>'+
								'<td class="spanDataCenter">' +
									'<span>'+objArray[i].subList[subRes].id+'</span>'+
								'</td>'+
								'<td class="spanDataLeft">'+
									'<span id="'+objArray[i].subList[subRes].id+'" class="guestName" >'+DisplayGuest+'</span>'+
								'</td>'+
								'<td class="spanDataCenter">'+
									'<span>'+formatDateCheckin+'-'+setFateFormatCheckoutRes.getFormatedString()+' ('+objArray[i].subList[subRes].span+')</span>'+
								'</td>'+
								'<td class="spanDataCenter"> '+
									'<span>'+objArray[i].subList[subRes].roomTypeName+'('+objArray[i].subList[subRes].roomName+')'+'</span>'+
								'</td>'+
								'<td class="spanDataCenter">' +
									'<span>'+adult+'('+objArray[i].subList[subRes].adult+') - '+child+'('+objArray[i].subList[subRes].child+')'+'</span>'+
								'</td>'+
								'<td class="spanDataLeft">'+
									StatusResInGroup+
								'</td>'+
								'<td class="spanDataCenter">'+
									'<span>'+toCurrencyString(currencyStringToNumber(objArray[i].subList[subRes].defaultCherge))+'</span>'+
								'</td>'+
								'<td class="spanDataCenter">'+
									'<span><div class="fongwordwarp" >'+DescriptionSubRes+'</div></span>'+
								'</td>'+
								'<td>'+
									objArray[i].subList[subRes].cleaningStatus+
								'</td>'+
								'<td class="spanDataCenter">'+
									'<div onmouseover="linkClick=false;" onmouseout="linkClick=true;" >'+
										'<span  onclick="printRoomManagementSinggle('+sendData+')" >'+printPci+'</span>'+
										'<span id="sendMail'+objArray[i].subList[subRes].id+'" onclick="sendMail(id)"> '+emailPic+'</span>'+
									'</div>'+
								'</td>'+
								'</tr>';
								textSubResPrint += '<tr clearTr="allReservation" class="'+statusRecord+'" onclick="if(linkClick==true&&ShowNameGuest!='+Empty+'){ CallEditReservedPageWithLoadElement(id,'+objArray[i].subList[subRes].id+')}"  id="btnEditS" >'+
								'<td colspan="2" class="spanDataPaddingLeftSub">'+
								runnumberSub+
								'</td>'+
								'<td class="spanDataCenter">' +
									'<span>'+objArray[i].subList[subRes].id+'</span>'+
								'</td>'+
								'<td class="spanDataLeft">'+
									'<span id="'+objArray[i].subList[subRes].id+'" class="guestName" >'+DisplayGuest+'</span>'+
								'</td>'+
								'<td class="spanDataCenter">'+
								'<span>'+formatDateCheckin+'-'+setFateFormatCheckoutRes.getFormatedString()+' ('+objArray[i].subList[subRes].span+')</span>'+
								'</td>'+
								'<td class="spanDataCenter"> '+
									'<span>'+objArray[i].subList[subRes].roomTypeName+'('+objArray[i].subList[subRes].roomName+')'+'</span>'+
								'</td>'+
								'<td class="spanDataCenter">' +
									'<span>'+adult+'('+objArray[i].subList[subRes].adult+') - '+child+'('+objArray[i].subList[subRes].child+')'+'</span>'+
								'</td>'+
								'<td class="spanDataLeft">'+
									StatusResInGroup+
								'</td>'+
								'<td class="spanDataCenter">'+
									'<span>'+toCurrencyString(currencyStringToNumber(objArray[i].subList[subRes].defaultCherge))+'</span>'+
								'</td>'+
								'<td>'+
									objArray[i].subList[subRes].cleaningStatus+
								'</td>'+
								'<td class="spanDataCenter">'+
									'<span><div class="fongwordwarp" >'+DescriptionSubRes+'</div></span>'+
								'</td>'+
								'</tr>';
						}
						///Check StatusGroup
						var obj = objArray[i].subList;
						showStatusResInGroup = checkStatusReservationGroup(obj);
						///
						// NameGroupEmpty
						var ShowNameGuestGroup = "";
						if(objArray[i].name!=undefined){
							ShowNameGuestGroup = objArray[i].name;
						}
						var dateFormatDisplay = setDateFormat.getFormatedString();
						var obj = objArray[i];
						var  checksub = 0;
						for (var k in obj)
						{
						    if(obj.subList!=undefined && checksub == 0){
						    	checksub = 1;
						    	var newsubListObjString = new Array();
						    	for(var sublistGroup=0;sublistGroup<obj.subList.length;sublistGroup++){
						    		var objsub = obj.subList[sublistGroup];
						    		for (var j in objsub)
									{
							    		if (objsub.hasOwnProperty(j))
									    {
											objsub[j] = String(objsub[j]);
											
									    }
									}
						    		newsubListObjString.push(objsub);
						    	}
						    	obj.subList = newsubListObjString;
						    }
							if (obj.hasOwnProperty(k))
						    {
						        if(k=="subList")
						        	continue;
								obj[k] = String(obj[k]);
						    }
						}
						objArray[i] = obj;
						var re2 = /"/gi;
						if(getCurrentTabData().beforePageAllReservation!=undefined&&getCurrentTabData().beforePageAllReservation!=""){
							numberSet = numberSet+1;
							number = numberSet;
						}else{
							number = (i+1);
						}
						var sendDataGroup = JSON.stringify(objArray[i]).replace(re2, "'");
							textRoomCheckIn += '<tr clearTr="allReservation" class="dataRecordGroup" onclick="if(linkClick) CallEditReservedPageWithLoadElement(id,'+objArray[i].groupIdString+')"  id="btnEditG" >'+
							'<td class="spanDataLeft">'+
							groupSplit+'<input name="group" agency="'+objArray[i].agencyString+'" group='+objArray[i].groupIdString+' type="radio" onmouseover="linkClick=false;" onmouseout="linkClick=true;" >'+number+'('+objArray[i].resList.split(",").length+')'+
							'</td>'+
							'<td class="spanDataCenter">'+
								'<span>G'+objArray[i].groupIdString+'</span>'+
							'</td>'+
							'<td class="spanDataCenter">' +
								'<span></span>'+
							'</td>'+
							'<td class="spanDataLeft">'+
								'<span class="ownerName" >'+ShowNameGuestGroup+'</span>'+
							'</td>'+
							'<td class="spanDataCenter">'+
								'<span>'+dateFormatDisplay+'-'+setFateFormatCheckout.getFormatedString()+' ('+objArray[i].span+')</span>'+
							'</td>'+
							'<td class="spanDataCenter"> '+
							'</td>'+
							'<td class="spanDataCenter">' +
								'<span></span>'+
							'</td>'+
							'<td class="spanDataLeft">'+
								'<span>'+showStatusResInGroup+'</span>'+
							'</td>'+
							'<td class="spanDataCenter">'+
								'<span></span>'+
							'</td>'+
							'<td class="spanDataCenter">'+
								'<span><div class="fongwordwarp" >'+Description+'</div></span>'+
							'</td>'+
							'<td>'+
							'</td>'+
							'<td class="spanDataCenter">'+
								'<div onmouseover="linkClick=false;" onmouseout="linkClick=true;" >'+
							'<span  onclick="printRoomManagementSinggle('+sendDataGroup+')" >'+printPci+'</span>'+
							'<span id="sendMail'+objArray[i].groupIdString+'" onclick="sendMail(id)"> '+emailPic+'</span></div>'+
							'</td>'+
							'</tr>'+textSubRes;
							textRoomCheckInPrint += '<tr clearTr="allReservation" class="dataRecordGroup" onclick="if(linkClick) CallEditReservedPageWithLoadElement(id,'+objArray[i].groupIdString+')"  id="btnEditG" >'+
							'<td class="spanDataCenter">'+
							number+'('+objArray[i].resList.split(",").length+')'+
							'</td>'+
							'<td class="spanDataCenter">'+
								'<span>G'+objArray[i].groupIdString+'</span>'+
							'</td>'+
							'<td class="spanDataCenter">' +
								'<span>'+objArray[i].id+'</span>'+
							'</td>'+
							'<td class="spanDataLeft">'+
								'<span class="ownerName" >'+ShowNameGuestGroup+'</span>'+
							'</td>'+
							'<td class="spanDataCenter">'+
								'<span>'+dateFormatDisplay+'-'+setFateFormatCheckout.getFormatedString()+' ('+objArray[i].span+')</span>'+
							'</td>'+
							'<td class="spanDataCenter"> '+
							'</td>'+
							'<td class="spanDataCenter">' +
								'<span></span>'+
							'</td>'+
							'<td class="spanDataLeft">'+
								'<span>'+showStatusResInGroup+'</span>'+
							'</td>'+
							'<td class="spanDataCenter">'+
								'<span></span>'+
							'</td>'+
							'<td></td>'+
							'<td class="spanDataCenter">'+
								'<span><div class="fongwordwarp" >'+Description+'</div></span>'+
							'</td>'+
							'</tr>'+textSubResPrint;
							checkBgColor =1;
							textSubRes = ""
				}else{
					var DescriptionSubRes = "";
					if(objArray[i].description!=undefined&&objArray[i].description!=""){
						DescriptionSubRes = objArray[i].description;
					}else{
						DescriptionSubRes = "";
					}
					var setDateFormatRes = new Date(objArray[i].date);
					var setFateFormatCheckoutRes = setDateFormatRes.addDate(objArray[i].span);
					var DisplayGuest = "";
					var formatDateCheckin = setDateFormatRes.getFormatedString();
					/// Name Empty
					if(objArray[i].name!=undefined){
						ShowNameGuest = objArray[i].name
					}else{
						ShowNameGuest = 0;
					}
					///
					if(objArray[i].reservationTitle=="Reserved Rooms"){
						StatusResInGroup = statusResv;
					}else if(objArray[i].reservationTitle=="Checked-out Rooms"){
						StatusResInGroup = statusCheckOut;
					}else if(objArray[i].reservationTitle=="Temp Rooms"){
						StatusResInGroup = statusTempResv;
					}else if(objArray[i].reservationTitle=="Cancel Reservation"){
						StatusResInGroup = statusCancel;
					}else{
						StatusResInGroup = statusCheckin;
					}
					if(checkBgColorG==0){
						statusRecord = 'dataRecordBot';
						checkBgColorG = 1;
					}else{
						statusRecord = 'dataRecordBot';
						checkBgColorG =0;
					}
					var displayNameGuest = "";
					if(ShowNameGuest==0){
						DisplayGuest = "-";
						displayNameGuest = '<tr clearTr="allReservation" class="'+statusRecord+'"  id="btnEditS" >';
					}else{
						DisplayGuest = ShowNameGuest;
						displayNameGuest = '<tr clearTr="allReservation" class="'+statusRecord+'" onclick="if(linkClick==true){ CallEditReservedPageWithLoadElement(id,'+objArray[i].id+')}"  id="btnEditS" >';
					}
					var obj = objArray[i];
					for (var k in obj){ if (obj.hasOwnProperty(k)){obj[k] = String(obj[k]);}} //object to string
					objArray[i] = obj;
					var re2 = /"/gi;
					var sendData = JSON.stringify(objArray[i]).replace(re2, "'");
					
					if(getCurrentTabData().beforePageAllReservation!=undefined&&getCurrentTabData().beforePageAllReservation!=""){
						
						runnumberSub = (numberSet)+"."+(numberSubSet);
						numberSubSet = numberSubSet+1;
					}else{
						runnumberSub = (i+1)+"."+(subRes+1);
					}
					textRoomCheckIn += displayNameGuest+
						'<td colspan="2" class="spanDataPaddingLeftSub">'+
							'<input groupId='+groupId+' name="subReservation" subres='+objArray[i].id+' type="checkbox" onmouseover="linkClick=false;" onmouseout="linkClick=true;" >'+runnumberSub+
						'</td>'+
						'<td class="spanDataCenter">' +
							'<span>'+objArray[i].groupIdString+'</span>'+
						'</td>'+
						'<td class="spanDataLeft">'+
							'<span id="'+objArray[i].id+'" class="guestName" >'+DisplayGuest+'</span>'+
						'</td>'+
						'<td class="spanDataCenter">'+
							'<span>'+formatDateCheckin+'-'+setFateFormatCheckoutRes.getFormatedString()+' ('+objArray[i].span+')</span>'+
						'</td>'+
						'<td class="spanDataCenter"> '+
							'<span>'+objArray[i].roomTypeName+'('+objArray[i].roomName+')'+'</span>'+
						'</td>'+
						'<td class="spanDataCenter">' +
							'<span>'+adult+'('+objArray[i].adult+') - '+child+'('+objArray[i].child+')'+'</span>'+
						'</td>'+
						'<td class="spanDataLeft">'+
							StatusResInGroup+
						'</td>'+
						'<td class="spanDataCenter">'+
							'<span>'+toCurrencyString(currencyStringToNumber(objArray[i].defaultCherge))+'</span>'+
						'</td>'+
						'<td class="spanDataCenter">'+
							'<span><div class="fongwordwarp" >'+DescriptionSubRes+'</div></span>'+
						'</td>'+
						'<td>'+
							objArray[i].cleaningStatus+
						'</td>'+
						'<td class="spanDataCenter">'+
							'<div onmouseover="linkClick=false;" onmouseout="linkClick=true;" >'+
								'<span  onclick="printRoomManagementSinggle('+sendData+')" >'+printPci+'</span>'+
								'<span id="sendMail'+objArray[i].id+'" onclick="sendMail(id)"> '+emailPic+'</span>'+
							'</div>'+
						'</td>'+
						'</tr>';
						
					textRoomCheckInPrint += '<tr clearTr="allReservation" class="'+statusRecord+'" onclick="if(linkClick==true&&ShowNameGuest!='+Empty+'){ CallEditReservedPageWithLoadElement(id,'+objArray[i].id+')}"  id="btnEditS" >'+
						'<td colspan="2" class="spanDataPaddingLeftSub">'+
						runnumberSub+
						'</td>'+
						'<td class="spanDataCenter">' +
							'<span>'+objArray[i].groupIdString+'</span>'+
						'</td>'+
						'<td class="spanDataLeft">'+
							'<span id="'+objArray[i].id+'" class="guestName" >'+DisplayGuest+'</span>'+
						'</td>'+
						'<td class="spanDataCenter">'+
						'<span>'+formatDateCheckin+'-'+setFateFormatCheckoutRes.getFormatedString()+' ('+objArray[i].span+')</span>'+
						'</td>'+
						'<td class="spanDataCenter"> '+
							'<span>'+objArray[i].roomTypeName+'('+objArray[i].roomName+')'+'</span>'+
						'</td>'+
						'<td class="spanDataCenter">' +
							'<span>'+adult+'('+objArray[i].adult+') - '+child+'('+objArray[i].child+')'+'</span>'+
						'</td>'+
						'<td class="spanDataLeft">'+
							StatusResInGroup+
						'</td>'+
						'<td class="spanDataCenter">'+
							'<span>'+toCurrencyString(currencyStringToNumber(objArray[i].defaultCherge))+'</span>'+
						'</td>'+
						'<td>'+
							objArray[i].cleaningStatus+
						'</td>'+
						'<td class="spanDataCenter">'+
							'<span><div class="fongwordwarp" >'+DescriptionSubRes+'</div></span>'+
						'</td>'+
						'</tr>';
				}
			}else{
				res = objArray[i].id;
				var setDateFormat = new Date(objArray[i].date);
				var setFateFormatCheckout = setDateFormat.addDate(objArray[i].span);
				getStatusResInGroup = objArray[i].reservationTitle;
				var formatDateCheckin = setDateFormat.getFormatedString();
				if(getStatusResInGroup=="Reserved Rooms"){
					showStatusResInGroup = statusResv;
				}else if(getStatusResInGroup=="Checked-out Rooms"){
					showStatusResInGroup = statusCheckOut;
				}else if(getStatusResInGroup=="Temp Rooms"){
					showStatusResInGroup = statusTempResv;
				}else if(getStatusResInGroup=="Cancel Reservation"){
					showStatusResInGroup = statusCancelCheckin;
				}else{
					showStatusResInGroup = statusCheckin;
				}
				
				if(checkBgColor==0){
					statusRecord = 'dataRecordBot';
					checkBgColor = 1;
				}else{
					statusRecord = 'dataRecordBot';
					checkBgColor =0;
				}
				var obj = objArray[i];
				for (var k in obj)//set integer to string in object
				{
				    if (obj.hasOwnProperty(k))
				    {
				        obj[k] = String(obj[k]);
				    }
				}
				objArray[i] = obj;
				var re2 = /"/gi;
				var sendData = JSON.stringify(objArray[i]).replace(re2, "'");//set format for data in javascript
				if(getCurrentTabData().beforePageAllReservation!=undefined&&getCurrentTabData().beforePageAllReservation!=""){
					numberSet = numberSet+1;
					number = numberSet;
				}else{
					number = (i+1);
				}
				if(setDateFormat.getFormatedString()!=undefined){
						textRoomCheckIn += '<tr clearTr="allReservation" class="'+statusRecord+'"  onclick="if(linkClick){ CallEditReservedPageWithLoadElement(id,'+objArray[i].id+')}" id="btnEditS" >'+
						'<td class="spanDataPaddingLeft">'+
							'<input pracketpriceid ='+objArray[i].pracketPriceId+' roomtypeid = '+objArray[i].roomTypeId+' name="checkboxAddToNewGroup" type="checkbox" id="'+objArray[i].id+'" onmouseover="linkClick=false;" onmouseout="linkClick=true;" >'+number+
						'</td>'+
						'<td class="spanDataCenter">'+
							'<span></span>'+
						'</td>'+
						'<td class="spanDataCenter">' +
							'<span>'+objArray[i].id+'</span>'+
						'</td>'+
						'<td class="spanDataLeft">'+
							'<span class="guestName" >'+objArray[i].name+'</span>'+
						'</td>'+
						'<td class="spanDataCenter">'+
							'<span date="'+objArray[i].date+'" spanDate="'+objArray[i].span+'">'+formatDateCheckin+'-'+setFateFormatCheckout.getFormatedString()+' ('+objArray[i].span+')</span>'+
						'</td>'+
						'<td class="spanDataCenter"> '+
							'<span>'+objArray[i].roomTypeName+'('+objArray[i].roomName+')'+'</span>'+
						'</td>'+
						'<td class="spanDataCenter">' +
						'<span>'+adult+'('+objArray[i].adult+') - '+child+'('+objArray[i].child+')'+'</span>'+
						'</td>'+
						'<td class="spanDataLeft">'+
							'<span>'+showStatusResInGroup+'</span>'+
						'</td>'+
						'<td class="spanDataCenter">'+
							'<span>'+toCurrencyString(currencyStringToNumber(objArray[i].defaultCherge))+'</span>'+
						'</td>'+
						'<td class="spanDataCenter">'+
							'<span><div class="fongwordwarp" >'+Description+'</div></span>'+
						'</td>'+
						'<td>'+
							objArray[i].cleaningStatus+
						'</td>'+
						'<td class="spanDataCenter">'+
							'<div onmouseover="linkClick=false;" onmouseout="linkClick=true;" >'+
							'<span  onclick="printRoomManagementSinggle('+sendData+')" >'+printPci+'</span>'+
							'<span id="sendMail'+objArray[i].id+'" onclick="sendMail(id)"> '+emailPic+'</span></div>'+
						'</td>'+
					'</tr>';
						textRoomCheckInPrint += '<tr clearTr="allReservation" class="'+statusRecord+'"  onclick="if(linkClick){ CallEditReservedPageWithLoadElement(id,'+objArray[i].id+')}" id="btnEditS" >'+
						'<td class="spanDataPaddingLeft">'+
							number+
						'</td>'+
						'<td class="spanDataCenter">'+
							'<span></span>'+
						'</td>'+
						'<td class="spanDataCenter">' +
							'<span>'+objArray[i].id+'</span>'+
						'</td>'+
						'<td class="spanDataLeft">'+
							'<span class="guestName" >'+objArray[i].name+'</span>'+
						'</td>'+
						'<td class="spanDataCenter">'+
							'<span date="'+objArray[i].date+'" spanDate="'+objArray[i].span+'">'+formatDateCheckin+'-'+setFateFormatCheckout.getFormatedString()+' ('+objArray[i].span+')</span>'+
						'</td>'+
						'<td class="spanDataCenter"> '+
							'<span>'+objArray[i].roomTypeName+'('+objArray[i].roomName+')'+'</span>'+
						'</td>'+
						'<td class="spanDataCenter">' +
						'<span>'+adult+'('+objArray[i].adult+') - '+child+'('+objArray[i].child+')'+'</span>'+
						'</td>'+
						'<td class="spanDataLeft">'+
							'<span>'+showStatusResInGroup+'</span>'+
						'</td>'+
						'<td class="spanDataCenter">'+
							'<span>'+toCurrencyString(currencyStringToNumber(objArray[i].defaultCherge))+'</span>'+
						'</td>'+
						'<td>'+
							objArray[i].cleaningStatus+
						'</td>'+
						'<td class="spanDataCenter">'+
							'<span><div class="fongwordwarp" >'+Description+'</div></span>'+
						'</td>'+
						'</tr>';
				}
			}
			//// SET OPTION STATUS RESERVATION
			var statusOption = objArray[i].reservationTitle;
			if(statusOption=="Reserved Rooms"){
				OptionReservation++;
			}else if(statusOption=="Checked-out Rooms"){
				OptionCheckout++;
			}else if(statusOption=="Checked-in Rooms"){
				OptionCheckIn++;
			}
		}
		if(countSetFilterTypeStatusAll==0){
			countSetFilterTypeStatusAll++;
			$("[setOption=TypeResvAll]")[0].options.length = 1;
			$("[setOption=TypeResvAll]").append( $("<option>").val(value="Reserved Rooms").html(value=statusResv));
			$("[setOption=TypeResvAll]").append( $("<option>").val(value="Checked-out Rooms").html(value=statusCheckOut));
			$("[setOption=TypeResvAll]").append( $("<option>").val(value="Checked-in Rooms").html(value=statusCheckin));
		}
		if(textRoomCheckIn==""){
			var textDataEmpty = '<tr clearTr="allReservation" >'+
			'<td colspan="100%" style="text-align:center;" >'+
			dataEmpty+
			'</td>'+
			'</tr>';
			textRoomCheckIn = textDataEmpty;
		}
		$("#CheckInListRoomManageMent_Id_Tr").replaceWith("<tr id=CheckInListRoomManageMent_Id_Tr ></tr>"+textRoomCheckIn);
		textPrint = textRoomCheckInPrint;
		textRoomCheckIn = "";
	}
	dateRoomManageMent({checkin:"calendar_btw_checkinAll",atrcheckin:"dateofBtwCheckinAll"},{checkout:"calendar_btw_checkoutAll",atrcheckout:"dateofBtwCheckoutAll"});
	$(".ui-datepicker-trigger").css("margin-top","2px");
	showDataResRoomManageMentSetPageAll(data,getCurrentTabData().lineAllreservation);
}

function showDataResRoomManageMentSetPageAll(data,output){
	$("[clearTr*=allReservationPage]").remove();
	if(data.trim()!=""&&data.trim()!="[]"&&data.trim()!="[[],[]]"){
		objArray = JSON.parse(data);
		objArray = objArray[1];
		for(var i =0;i<objArray.length;i++){
			var textSubRes = "";
			if(objArray[i].groupId!="0"){
				var statusRecord = "";
				for(var subRes = 0;subRes<objArray[i].subList.length;subRes++){
					textSubRes += '<tr clearTr=allReservationPage ><td></td></tr>';
				}
				textRoomCheckIn += '<tr clearTr=allReservationPage class="trcheallreservation" ><td></td></tr>'+textSubRes;
			}else{
				textRoomCheckIn += '<tr clearTr=allReservationPage ><td></td></tr>';
			}
		}
		
		$("[name = CheckInListRoomManageMent_Id_Tr2]").replaceWith("<tr name=CheckInListRoomManageMent_Id_Tr2></tr>"+textRoomCheckIn);
		textRoomCheckIn = "";
		textSubRes = "";
	}
	showPager(output);
	closeWaitingDialog();
}

function showDataResRoomManageMentSetCountAllReservation(data,output){
	var subCount = 0;
	var recCount = 0;
	var objArray = new Array();
	if((data=="textSearch"||data=="G"||data=="S"||data=="A"||data=="reservationType_A"||data=="Checked-out Rooms"||data=="Checked-in Rooms")&&data!="dateSearch"){
		objArray = oldObjArrayAllReservation;
		objArrayCheck = objArray[0];
		objArray = objArray[1];
	}else{
		objArray = JSON.parse(data);
		oldObjArrayAllReservation = objArray;
		objArrayCheck = objArray[0];
		objArray = objArray[1];
	}
	setRowObjArrayCheckout = objArray;
	sortIdRoommanagement(objArray);
	sortIdRoommanagement(objArrayCheck);
	for(var i =0;i<objArray.length;i++){
		if(objArray[i].groupId!="0"){
			if(objArray[i].subList!=undefined){
				if(objArrayCheck[objArrayCheck.length-1].groupId==objArray[i].groupId){
					recCount = (i+1);
					subCount = objArrayCheck[objArrayCheck.length-1].subList.length+1;
					break;
				}
			}else{
				if(objArrayCheck[objArrayCheck.length-1].groupId==objArray[i].groupId){
					recCount = (i+1);
					break;
				}
			}
		}else{
			if(objArrayCheck[objArrayCheck.length-1].id==objArray[i].id){
				recCount = (i+1);
				break;
			}
		}
	}
	
	getCurrentTabData().beforePageAllReservation = (recCount);
	getCurrentTabData().beforeSubPageAllReservation = subCount;
	simpleserviceSyn(getCurrentTabData().linkSet,null,showDataResRoomAllManageMent,data);
}

function setPagerAllReservation(){
	getCurrentTabData().tablePager = "tablepagingAllReservation";
	getCurrentTabData().pagerNumberField = "pagerCheckInListRoomManageMent";
	getCurrentTabData().functionGetData = "getReservationRoomAllManageMent";
	getCurrentTabData().pageName = "CheckInListRoomManageMent";
	getCurrentTabData().pageNavPosition = "pageNavPositionAllReservation";
	getCurrentTabData().trCheck = "trcheallreservation";
	if(getCurrentTabData().checkinAllreservation!=undefined&&getCurrentTabData().checkinAllreservation!=""){
		$('#calendar_btw_checkinAll').val($.datepicker.parseDate("yy-mm-dd",getCurrentTabData().checkinAllreservation).getFormatedString());
		$('#calendar_btw_checkinAll').attr('dateofBtwCheckinAll',getCurrentTabData().checkinAllreservation);
	}
	if(getCurrentTabData().checkoutAllreservation!=undefined&&getCurrentTabData().checkoutAllreservation!=""){
		$('#calendar_btw_checkoutAll').val($.datepicker.parseDate("yy-mm-dd",getCurrentTabData().checkoutAllreservation).getFormatedString());
		$('#calendar_btw_checkoutAll').attr('dateofBtwCheckoutAll',getCurrentTabData().checkoutAllreservation);
	}
	if(getCurrentTabData().typeReservationAll!=undefined){
		$('#typeCheckReservationAll option[value='+getCurrentTabData().typeReservationAll+']').attr('selected', 'selected');
	}
	if(getCurrentTabData().TypeResvAll!=undefined){
		//$($('[setoption=TypeResvAll] option[value='+getCurrentTabData().TypeResvAll+']')).attr('selected', 'selected');
		$($('[setoption=TypeResvAll] :first option[value="'+getCurrentTabData().TypeResvAll+'"]')).attr('selected', 'selected')
	}
}

function typeReservationAllFunction(dataOld,offfset,pagePointer,dateCheckin,dateCheckout,data,searchName){
	if(dataOld=="G"){
		getCurrentTabData().typeReservationAll = dataOld;
		if(pagePointer>1){
			var link = "/reservationService?func=getReservationAllGroup&offset="
				+offfset+"&line="+getCurrentTabData().lineAllreservation+"&pagePointer="
				+(pagePointer-1)+"&dateCheckin="+dateCheckin+"&dateCheckout="+dateCheckout+"&typereservation="+data+"&SearchAll_checkoutPage="+searchName;
			var linkSet = "/reservationService?func=getReservationAllGroup&offset="
				+offfset+"&line="+getCurrentTabData().lineAllreservation+"&pagePointer="
				+pagePointer+"&dateCheckin="+dateCheckin+"&dateCheckout="+dateCheckout+"&typereservation="+data+"&SearchAll_checkoutPage="+searchName;
			getCurrentTabData().linkSet = linkSet;
			simpleservice(link,null,showDataResRoomManageMentSetCountAllReservation,getCurrentTabData().lineAllreservation);
		}else{
			getCurrentTabData().beforePageAllReservation = ""; 
			getCurrentTabData().beforeSubPageAllReservation = "";
			var link = "/reservationService?func=getReservationAllGroup&offset="
				+offfset+"&line="+getCurrentTabData().lineAllreservation+"&pagePointer="
				+pagePointer+"&dateCheckin="+dateCheckin+"&dateCheckout="+dateCheckout+"&typereservation="+data+"&SearchAll_checkoutPage="+searchName;
			simpleservice(link,null,showDataResRoomAllManageMent,"dateSearch");
		}
	}else if(dataOld=="S"){
		getCurrentTabData().typeReservationAll = dataOld;
		if(pagePointer>1){
			var link = "/reservationService?func=getReservationAllSingle&offset="
				+offfset+"&line="+getCurrentTabData().lineAllreservation+"&pagePointer="+(pagePointer-1)+"&dateCheckin="
				+dateCheckin+"&dateCheckout="+dateCheckout+"&typereservation="+data+"&SearchAll_checkoutPage="+searchName;
			var linkSet = "/reservationService?func=getReservationAllSingle&offset="
				+offfset+"&line="+getCurrentTabData().lineAllreservation+"&pagePointer="+pagePointer+"&dateCheckin="
				+dateCheckin+"&dateCheckout="+dateCheckout+"&typereservation="+data+"&SearchAll_checkoutPage="+searchName;
			getCurrentTabData().linkSet = linkSet;
			simpleservice(link,null,showDataResRoomManageMentSetCountAllReservation,getCurrentTabData().lineAllreservation);
		}else{
			getCurrentTabData().beforePageAllReservation = ""; 
			getCurrentTabData().beforeSubPageAllReservation = "";
			var link = "/reservationService?func=getReservationAllSingle&offset="
				+offfset+"&line="+getCurrentTabData().lineAllreservation+"&pagePointer="+pagePointer+"&dateCheckin="
				+dateCheckin+"&dateCheckout="+dateCheckout+"&typereservation="+data+"&SearchAll_checkoutPage="+searchName;
			simpleservice(link,null,showDataResRoomAllManageMent,"dateSearch");
		}
	}else if(dataOld=="A"){
		getCurrentTabData().typeReservationAll = dataOld;
		if(pagePointer>1){
			var link = "/reservationService?func=getReservationAll&offset="
				+offfset+"&line="+getCurrentTabData().lineAllreservation+"&pagePointer="+(pagePointer-1)+"&dateCheckin="
				+dateCheckin+"&dateCheckout="+dateCheckout+"&typereservation="+data+"&SearchAll_checkoutPage="+searchName;
			var linkSet = "/reservationService?func=getReservationAll&offset="
				+offfset+"&line="+getCurrentTabData().lineAllreservation+"&pagePointer="+pagePointer+"&dateCheckin="
				+dateCheckin+"&dateCheckout="+dateCheckout+"&typereservation="+data+"&SearchAll_checkoutPage="+searchName;
			getCurrentTabData().linkSet = linkSet;
			simpleservice(link,null,showDataResRoomManageMentSetCountAllReservation,getCurrentTabData().lineAllreservation);
		}else{
			
			getCurrentTabData().beforePageAllReservation = ""; 
			getCurrentTabData().beforeSubPageAllReservation = "";
			var link = "/reservationService?func=getReservationAll&offset="
				+offfset+"&line="+getCurrentTabData().lineAllreservation+"&pagePointer="+pagePointer+"&dateCheckin="
				+dateCheckin+"&dateCheckout="+dateCheckout+"&typereservation="+data+"&SearchAll_checkoutPage="+searchName;
			simpleservice(link,null,showDataResRoomAllManageMent,"dateSearch");
		}
	}
}